home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Workbench Add-On
/
Workbench Add-On - Volume 1.iso
/
Gfx
/
Edit
/
ImageEngineer
/
ARexx
/
batch_convert.rexx
next >
Wrap
OS/2 REXX Batch file
|
1995-03-19
|
3KB
|
101 lines
/* Image Engineer Script */
/* Batch convert and render script */
/* by Simon Edwards */
/* */
/* Demonstrates how to use ARexx to batch */
/* load, render, convert and save images. */
Options results /* We want results */
options failat 10 /* We want everything >10 to be treated as errors */
signal on error /* Setup a place for errors to go */
address 'IMAGEENGINEER'
'IE_To_Front' /* Bring ***** to the front of the display */
'TYPE 24bit' /* Set load type */
/* Get some file names from the user */
'GET_FILES "Select files to convert"'
if RC=5 then exit /* See if the user cancelled the requester */
MyFileList=RESULT
/* Ask the user how they want to render the images */
'GET_RENDER COLOUR "Set render options" 0 593920 8 1 256 1 2'
if RC=5 then exit
RenderOptions=RESULT
/* Get the desitination directory from the user */
'GET_DIR "Select Destination Directory"'
if RC=5 then exit
DestDir=result
endpart=right(DestDir,1)
if endpart~=":" & endpart~="/" then DestDir=DestDir||"/"
/* get the destination file format */
'GET_FILE_TYPE "Select Destination File Format"'
If RC=5 then exit
FileType=RESULT
/* Let the user enter a file extension to use */
parse var FileType fileext .
'GET_STRING "Enter file extension" "Ok|Cancel" ".'||fileext||'"'
if RC=5 then exit
FileExt=RESULT
/* Ask the user if they would like this done in the Background */
'REQUEST "Shall I do this in the Foreground or Background?" "Fore|Back"'
Fore=RESULT
if Fore~=1 then do /* If we should work in the background then */
'WB_TO_FRONT' /* we need to bring the WB to the front and */
'SET_PRI -1' /* drop our task priority to something friendly */
end
/* Keep going till we run out of files */
do while MyFileList~=""
parse var MyFileList x ';' MyFileList /* Get the next file name */
parse var x ':' temp /* Extract the file name from the complete path */
if temp="" then temp=x
do forever
parse var temp FileName '/' temp
if temp ="" then break
end
'OPEN "'||x||'"' /* Open the image */
if RC=5 then exit
Project=RESULT
'SET_RENDER' Project RenderOptions /* Set up this imges render options */
if Fore=1 then do /* See if we should be quiet or not when rendering */
'RENDER' Project
end
else do
/* We're in the background so we should render quietly */
'RENDER' Project 'QUIET'
end
if RC=5 then exit
/* Save the rendered image */
'SAVE' Project '"'||destdir||filename||fileext||'" "'||filetype||'"'
if RC=5 then exit
'CLOSE' Project
end
'IE_TO_FRONT'
'SET_PRI 0'
'REQUEST "All done."'
exit
/*******************************************************************/
/* This is where control goes when an error code is returned by IE */
/* It puts up a message saying what happened and on which line */
/*******************************************************************/
Error:
'IE_TO_FRONT'
'LAST_ERROR'
'REQUEST "Error detected!!!'||D2C(10)||'Image Engineer error message is as follows'||D2C(10)||result||D2C(10)||'Script failed on line '||SIGL||'"' 'Doh!'
'SET_PRI 0'
exit